<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.5"/>
<title>spi: xspi_numonyx_flash_quad_example.c File Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
  $(document).ready(initResizable);
  $(window).load(resizeHeight);
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
<link href="HTML_custom.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectlogo"><img alt="Logo" src="xlogo_bg.png"/></td>
  <td style="padding-left: 0.5em;">
   <div id="projectname">spi
   </div>
   <div id="projectbrief">Vitis Drivers API Documentation</div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.5 -->
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Overview</span></a></li>
      <li><a href="annotated.html"><span>Data&#160;Structures</span></a></li>
      <li><a href="globals.html"><span>APIs</span></a></li>
      <li><a href="files.html"><span>File&#160;List</span></a></li>
      <li><a href="pages.html"><span>Examples</span></a></li>
    </ul>
  </div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
      <div id="nav-sync" class="sync"></div>
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
$(document).ready(function(){initNavTree('xspi__numonyx__flash__quad__example_8c.html','');});
</script>
<div id="doc-content">
<div class="header">
  <div class="summary">
<a href="#define-members">Macros</a> &#124;
<a href="#func-members">Functions</a>  </div>
  <div class="headertitle">
<div class="title">xspi_numonyx_flash_quad_example.c File Reference</div>  </div>
</div><!--header-->
<div class="contents">
<a name="details" id="details"></a><h2 class="groupheader">Overview</h2>
<div class="textblock"><p>This file contains a design example using the SPI driver (<a class="el" href="struct_x_spi.html" title="The XSpi driver instance data. ">XSpi</a>) and axi_qspi device with a Numonyx quad serial flash device in the interrupt mode. </p>
<p>This example erases a Sector, writes to a Page within the Sector, reads back from that Page and compares the data.</p>
<p>This example has been tested with an N25Q128 device on KC705 and ZC770 board. The bytes per page (PAGE_SIZE) in N25Q128 is 256.</p>
<dl class="section note"><dt>Note</dt><dd></dd></dl>
<p>None.</p>
<pre>
MODIFICATION HISTORY:</pre><pre>Ver   Who  Date     Changes
</p>
<hr/>
<p>
1.00a bss  08/08/12 First release
3.04a bss  02/11/13 Modified to use ScuGic in case of Zynq (CR#683510)
4.2   ms   01/23/17 Added xil_printf statement in main function to
                    ensure that "Successfully ran" and "Failed" strings
                    are available in all examples. This is a fix for
                    CR-965028.
      ms   04/05/17 Modified Comment lines to follow doxygen rules.
4.11  sb   07/11/23 Added support for system device-tree flow.
</pre> </div><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="define-members"></a>
Macros</h2></td></tr>
<tr class="memitem:ab499519eaab61d0f334591c02a7b15f1"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="xspi__numonyx__flash__quad__example_8c.html#ab499519eaab61d0f334591c02a7b15f1">READ_WRITE_EXTRA_BYTES</a>&#160;&#160;&#160;4 /* Read/Write extra bytes */</td></tr>
<tr class="memdesc:ab499519eaab61d0f334591c02a7b15f1"><td class="mdescLeft">&#160;</td><td class="mdescRight">This definitions specify the EXTRA bytes in each of the command transactions.  <a href="#ab499519eaab61d0f334591c02a7b15f1">More...</a><br/></td></tr>
<tr class="separator:ab499519eaab61d0f334591c02a7b15f1"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a>
Functions</h2></td></tr>
<tr class="memitem:a48599e715e854c930ad7682db64c5716"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="xspi__numonyx__flash__quad__example_8c.html#a48599e715e854c930ad7682db64c5716">SpiFlashWriteEnable</a> (<a class="el" href="struct_x_spi.html">XSpi</a> *SpiPtr)</td></tr>
<tr class="memdesc:a48599e715e854c930ad7682db64c5716"><td class="mdescLeft">&#160;</td><td class="mdescRight">This function enables writes to the Numonyx Serial Flash memory.  <a href="#a48599e715e854c930ad7682db64c5716">More...</a><br/></td></tr>
<tr class="separator:a48599e715e854c930ad7682db64c5716"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a639435b86afe1f3a18334d679371509b"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="xspi__numonyx__flash__quad__example_8c.html#a639435b86afe1f3a18334d679371509b">SpiFlashWrite</a> (<a class="el" href="struct_x_spi.html">XSpi</a> *SpiPtr, u32 Addr, u32 ByteCount, u8 WriteCmd)</td></tr>
<tr class="memdesc:a639435b86afe1f3a18334d679371509b"><td class="mdescLeft">&#160;</td><td class="mdescRight">This function writes the data to the specified locations in the Numonyx Serial Flash memory.  <a href="#a639435b86afe1f3a18334d679371509b">More...</a><br/></td></tr>
<tr class="separator:a639435b86afe1f3a18334d679371509b"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ac94156992ca0662d45a6a79e77ae5469"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="xspi__numonyx__flash__quad__example_8c.html#ac94156992ca0662d45a6a79e77ae5469">SpiFlashRead</a> (<a class="el" href="struct_x_spi.html">XSpi</a> *SpiPtr, u32 Addr, u32 ByteCount, u8 ReadCmd)</td></tr>
<tr class="memdesc:ac94156992ca0662d45a6a79e77ae5469"><td class="mdescLeft">&#160;</td><td class="mdescRight">This function reads the data from the Numonyx Serial Flash Memory.  <a href="#ac94156992ca0662d45a6a79e77ae5469">More...</a><br/></td></tr>
<tr class="separator:ac94156992ca0662d45a6a79e77ae5469"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a86d8ebdee181c36e305d15812df9d774"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="xspi__numonyx__flash__quad__example_8c.html#a86d8ebdee181c36e305d15812df9d774">SpiFlashBulkErase</a> (<a class="el" href="struct_x_spi.html">XSpi</a> *SpiPtr)</td></tr>
<tr class="memdesc:a86d8ebdee181c36e305d15812df9d774"><td class="mdescLeft">&#160;</td><td class="mdescRight">This function erases the entire contents of the Numonyx Serial Flash device.  <a href="#a86d8ebdee181c36e305d15812df9d774">More...</a><br/></td></tr>
<tr class="separator:a86d8ebdee181c36e305d15812df9d774"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ab9756ea6473f94b75dc9c44df1a55705"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="xspi__numonyx__flash__quad__example_8c.html#ab9756ea6473f94b75dc9c44df1a55705">SpiFlashSectorErase</a> (<a class="el" href="struct_x_spi.html">XSpi</a> *SpiPtr, u32 Addr)</td></tr>
<tr class="memdesc:ab9756ea6473f94b75dc9c44df1a55705"><td class="mdescLeft">&#160;</td><td class="mdescRight">This function erases the contents of the specified Sector in the Numonyx Serial Flash device.  <a href="#ab9756ea6473f94b75dc9c44df1a55705">More...</a><br/></td></tr>
<tr class="separator:ab9756ea6473f94b75dc9c44df1a55705"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a4007c2150a6cc4c1f0e890fcb784a52e"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="xspi__numonyx__flash__quad__example_8c.html#a4007c2150a6cc4c1f0e890fcb784a52e">SpiFlashGetStatus</a> (<a class="el" href="struct_x_spi.html">XSpi</a> *SpiPtr)</td></tr>
<tr class="memdesc:a4007c2150a6cc4c1f0e890fcb784a52e"><td class="mdescLeft">&#160;</td><td class="mdescRight">This function reads the Status register of the Numonyx Flash.  <a href="#a4007c2150a6cc4c1f0e890fcb784a52e">More...</a><br/></td></tr>
<tr class="separator:a4007c2150a6cc4c1f0e890fcb784a52e"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:aa80e27c647fe6b86b58019a9af60c1b3"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="xspi__numonyx__flash__quad__example_8c.html#aa80e27c647fe6b86b58019a9af60c1b3">SpiFlashQuadEnable</a> (<a class="el" href="struct_x_spi.html">XSpi</a> *SpiPtr)</td></tr>
<tr class="memdesc:aa80e27c647fe6b86b58019a9af60c1b3"><td class="mdescLeft">&#160;</td><td class="mdescRight">This function sets the QuadEnable bit in Winbond flash.  <a href="#aa80e27c647fe6b86b58019a9af60c1b3">More...</a><br/></td></tr>
<tr class="separator:aa80e27c647fe6b86b58019a9af60c1b3"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a29b2b437252838fd655646e018a44fa8"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="xspi__numonyx__flash__quad__example_8c.html#a29b2b437252838fd655646e018a44fa8">SpiFlashEnableHPM</a> (<a class="el" href="struct_x_spi.html">XSpi</a> *SpiPtr)</td></tr>
<tr class="memdesc:a29b2b437252838fd655646e018a44fa8"><td class="mdescLeft">&#160;</td><td class="mdescRight">This function enabled High Performance Mode in Winbond flash, so that data can be read from the flash using DIO and QIO commands.  <a href="#a29b2b437252838fd655646e018a44fa8">More...</a><br/></td></tr>
<tr class="separator:a29b2b437252838fd655646e018a44fa8"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:aacdc7be0761bc23854d5f1b9c6dbe36a"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="xspi__numonyx__flash__quad__example_8c.html#aacdc7be0761bc23854d5f1b9c6dbe36a">SpiHandler</a> (void *CallBackRef, u32 StatusEvent, unsigned int ByteCount)</td></tr>
<tr class="memdesc:aacdc7be0761bc23854d5f1b9c6dbe36a"><td class="mdescLeft">&#160;</td><td class="mdescRight">This function is the handler which performs processing for the SPI driver.  <a href="#aacdc7be0761bc23854d5f1b9c6dbe36a">More...</a><br/></td></tr>
<tr class="separator:aacdc7be0761bc23854d5f1b9c6dbe36a"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a840291bc02cba5474a4cb46a9b9566fe"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="xspi__numonyx__flash__quad__example_8c.html#a840291bc02cba5474a4cb46a9b9566fe">main</a> (void)</td></tr>
<tr class="memdesc:a840291bc02cba5474a4cb46a9b9566fe"><td class="mdescLeft">&#160;</td><td class="mdescRight">Main function to run the quad flash example.  <a href="#a840291bc02cba5474a4cb46a9b9566fe">More...</a><br/></td></tr>
<tr class="separator:a840291bc02cba5474a4cb46a9b9566fe"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<h2 class="groupheader">Macro Definition Documentation</h2>
<a class="anchor" id="ab499519eaab61d0f334591c02a7b15f1"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">#define READ_WRITE_EXTRA_BYTES&#160;&#160;&#160;4 /* Read/Write extra bytes */</td>
        </tr>
      </table>
</div><div class="memdoc">

<p>This definitions specify the EXTRA bytes in each of the command transactions. </p>
<p>This count includes Command byte, address bytes and any don't care bytes needed. </p>

<p>Referenced by <a class="el" href="xspi__numonyx__flash__quad__example_8c.html#a840291bc02cba5474a4cb46a9b9566fe">main()</a>, <a class="el" href="xspi__numonyx__flash__quad__example_8c.html#ac94156992ca0662d45a6a79e77ae5469">SpiFlashRead()</a>, and <a class="el" href="xspi__numonyx__flash__quad__example_8c.html#a639435b86afe1f3a18334d679371509b">SpiFlashWrite()</a>.</p>

</div>
</div>
<h2 class="groupheader">Function Documentation</h2>
<a class="anchor" id="a840291bc02cba5474a4cb46a9b9566fe"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int main </td>
          <td>(</td>
          <td class="paramtype">void&#160;</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Main function to run the quad flash example. </p>
<dl class="section return"><dt>Returns</dt><dd>XST_SUCCESS if successful else XST_FAILURE.</dd></dl>
<dl class="section note"><dt>Note</dt><dd>None </dd></dl>

<p>References <a class="el" href="struct_x_spi___config.html#a495ec19a4ab441ea59a0e220f0728dd9">XSpi_Config::BaseAddress</a>, <a class="el" href="xspi__numonyx__flash__quad__example_8c.html#ab499519eaab61d0f334591c02a7b15f1">READ_WRITE_EXTRA_BYTES</a>, <a class="el" href="xspi__numonyx__flash__quad__example_8c.html#ac94156992ca0662d45a6a79e77ae5469">SpiFlashRead()</a>, <a class="el" href="xspi__numonyx__flash__quad__example_8c.html#ab9756ea6473f94b75dc9c44df1a55705">SpiFlashSectorErase()</a>, <a class="el" href="xspi__numonyx__flash__quad__example_8c.html#a639435b86afe1f3a18334d679371509b">SpiFlashWrite()</a>, <a class="el" href="xspi__numonyx__flash__quad__example_8c.html#a48599e715e854c930ad7682db64c5716">SpiFlashWriteEnable()</a>, <a class="el" href="xspi__atmel__flash__example_8c.html#aacdc7be0761bc23854d5f1b9c6dbe36a">SpiHandler()</a>, <a class="el" href="group__spi.html#gac2c043a14b04e38a61b1979ccaa8a200">XSP_MASTER_OPTION</a>, <a class="el" href="group__spi.html#ga858155b42d5a1da8efe06c9098e40b2d">XSpi_CfgInitialize()</a>, <a class="el" href="group__spi.html#gaf3863f11d27469d8797424319601c980">XSpi_InterruptHandler()</a>, <a class="el" href="group__spi.html#gac2c4a169e05ad6e040796ae86100fd5b">XSpi_LookupConfig()</a>, <a class="el" href="group__spi.html#ga67c2076b133a55b6f80343642a1ace41">XSpi_SetOptions()</a>, <a class="el" href="group__spi.html#ga162523a3e9b29f063701db303ac8cf17">XSpi_SetSlaveSelect()</a>, <a class="el" href="group__spi.html#gabc09f4d503de2a772e5079ac46fc62b6">XSpi_SetStatusHandler()</a>, and <a class="el" href="group__spi.html#ga87fdaad742a2669200c9b2617e5c86ea">XSpi_Start()</a>.</p>

</div>
</div>
<a class="anchor" id="a86d8ebdee181c36e305d15812df9d774"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int SpiFlashBulkErase </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="struct_x_spi.html">XSpi</a> *&#160;</td>
          <td class="paramname"><em>SpiPtr</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>This function erases the entire contents of the Numonyx Serial Flash device. </p>
<p>This function erases the entire contents of the Winbond Serial Flash device.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">SpiPtr</td><td>is a pointer to the instance of the Spi device.</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>XST_SUCCESS if successful else XST_FAILURE.</dd></dl>
<dl class="section note"><dt>Note</dt><dd>The erased bytes will read as 0xFF. </dd></dl>

<p>References <a class="el" href="group__spi.html#ga4c44c082ef2d2b9cf4ba3db8bcebd954">XSpi_Transfer()</a>.</p>

</div>
</div>
<a class="anchor" id="a29b2b437252838fd655646e018a44fa8"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int SpiFlashEnableHPM </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="struct_x_spi.html">XSpi</a> *&#160;</td>
          <td class="paramname"><em>SpiPtr</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>This function enabled High Performance Mode in Winbond flash, so that data can be read from the flash using DIO and QIO commands. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">SpiPtr</td><td>is a pointer to the instance of the Spi device.</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>XST_SUCCESS if successful else XST_FAILURE.</dd></dl>
<dl class="section note"><dt>Note</dt><dd>None. </dd></dl>

<p>References <a class="el" href="xspi__numonyx__flash__quad__example_8c.html#a48599e715e854c930ad7682db64c5716">SpiFlashWriteEnable()</a>, and <a class="el" href="group__spi.html#ga4c44c082ef2d2b9cf4ba3db8bcebd954">XSpi_Transfer()</a>.</p>

<p>Referenced by <a class="el" href="xspi__winbond__flash__quad__example_8c.html#a840291bc02cba5474a4cb46a9b9566fe">main()</a>.</p>

</div>
</div>
<a class="anchor" id="a4007c2150a6cc4c1f0e890fcb784a52e"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int SpiFlashGetStatus </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="struct_x_spi.html">XSpi</a> *&#160;</td>
          <td class="paramname"><em>SpiPtr</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>This function reads the Status register of the Numonyx Flash. </p>
<p>This function reads the Status register of the Winbond Flash.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">SpiPtr</td><td>is a pointer to the instance of the Spi device.</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>XST_SUCCESS if successful else XST_FAILURE.</dd></dl>
<dl class="section note"><dt>Note</dt><dd>The status register content is stored at the second byte pointed by the ReadBuffer. </dd></dl>

<p>References <a class="el" href="group__spi.html#ga4c44c082ef2d2b9cf4ba3db8bcebd954">XSpi_Transfer()</a>.</p>

</div>
</div>
<a class="anchor" id="aa80e27c647fe6b86b58019a9af60c1b3"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int SpiFlashQuadEnable </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="struct_x_spi.html">XSpi</a> *&#160;</td>
          <td class="paramname"><em>SpiPtr</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>This function sets the QuadEnable bit in Winbond flash. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">SpiPtr</td><td>is a pointer to the instance of the Spi device.</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>XST_SUCCESS if successful else XST_FAILURE.</dd></dl>
<dl class="section note"><dt>Note</dt><dd>None. </dd></dl>

<p>References <a class="el" href="xspi__numonyx__flash__quad__example_8c.html#a48599e715e854c930ad7682db64c5716">SpiFlashWriteEnable()</a>, and <a class="el" href="group__spi.html#ga4c44c082ef2d2b9cf4ba3db8bcebd954">XSpi_Transfer()</a>.</p>

<p>Referenced by <a class="el" href="xspi__winbond__flash__quad__example_8c.html#a840291bc02cba5474a4cb46a9b9566fe">main()</a>.</p>

</div>
</div>
<a class="anchor" id="ac94156992ca0662d45a6a79e77ae5469"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int SpiFlashRead </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="struct_x_spi.html">XSpi</a> *&#160;</td>
          <td class="paramname"><em>SpiPtr</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">u32&#160;</td>
          <td class="paramname"><em>Addr</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">u32&#160;</td>
          <td class="paramname"><em>ByteCount</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">u8&#160;</td>
          <td class="paramname"><em>ReadCmd</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>This function reads the data from the Numonyx Serial Flash Memory. </p>
<p>This function reads the data from the Winbond Serial Flash Memory.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">SpiPtr</td><td>is a pointer to the instance of the Spi device. </td></tr>
    <tr><td class="paramname">Addr</td><td>is the starting address in the Flash Memory from which the data is to be read. </td></tr>
    <tr><td class="paramname">ByteCount</td><td>is the number of bytes to be read.</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>XST_SUCCESS if successful else XST_FAILURE.</dd></dl>
<dl class="section note"><dt>Note</dt><dd>None</dd></dl>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">SpiPtr</td><td>is a pointer to the instance of the Spi device. </td></tr>
    <tr><td class="paramname">Addr</td><td>is the starting address in the Flash Memory from which the data is to be read. </td></tr>
    <tr><td class="paramname">ByteCount</td><td>is the number of bytes to be read. </td></tr>
    <tr><td class="paramname">ReadCmd</td><td>is the command used for reading data from flash.</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>XST_SUCCESS if successful else XST_FAILURE.</dd></dl>
<dl class="section note"><dt>Note</dt><dd>None </dd></dl>

<p>References <a class="el" href="xspi__numonyx__flash__quad__example_8c.html#ab499519eaab61d0f334591c02a7b15f1">READ_WRITE_EXTRA_BYTES</a>, and <a class="el" href="group__spi.html#ga4c44c082ef2d2b9cf4ba3db8bcebd954">XSpi_Transfer()</a>.</p>

<p>Referenced by <a class="el" href="xspi__numonyx__flash__quad__example_8c.html#a840291bc02cba5474a4cb46a9b9566fe">main()</a>.</p>

</div>
</div>
<a class="anchor" id="ab9756ea6473f94b75dc9c44df1a55705"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int SpiFlashSectorErase </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="struct_x_spi.html">XSpi</a> *&#160;</td>
          <td class="paramname"><em>SpiPtr</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">u32&#160;</td>
          <td class="paramname"><em>Addr</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>This function erases the contents of the specified Sector in the Numonyx Serial Flash device. </p>
<p>This function erases the contents of the specified Sector in the Winbond Serial Flash device.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">SpiPtr</td><td>is a pointer to the instance of the Spi device. </td></tr>
    <tr><td class="paramname">Addr</td><td>is the address within a sector of the Buffer, which is to be erased.</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>XST_SUCCESS if successful else XST_FAILURE.</dd></dl>
<dl class="section note"><dt>Note</dt><dd>The erased bytes will be read back as 0xFF. </dd></dl>

<p>References <a class="el" href="group__spi.html#ga4c44c082ef2d2b9cf4ba3db8bcebd954">XSpi_Transfer()</a>.</p>

<p>Referenced by <a class="el" href="xspi__numonyx__flash__quad__example_8c.html#a840291bc02cba5474a4cb46a9b9566fe">main()</a>.</p>

</div>
</div>
<a class="anchor" id="a639435b86afe1f3a18334d679371509b"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int SpiFlashWrite </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="struct_x_spi.html">XSpi</a> *&#160;</td>
          <td class="paramname"><em>SpiPtr</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">u32&#160;</td>
          <td class="paramname"><em>Addr</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">u32&#160;</td>
          <td class="paramname"><em>ByteCount</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">u8&#160;</td>
          <td class="paramname"><em>WriteCmd</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>This function writes the data to the specified locations in the Numonyx Serial Flash memory. </p>
<p>This function writes the data to the specified locations in the Winbond Serial Flash memory.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">SpiPtr</td><td>is a pointer to the instance of the Spi device. </td></tr>
    <tr><td class="paramname">Addr</td><td>is the address in the Buffer, where to write the data. </td></tr>
    <tr><td class="paramname">ByteCount</td><td>is the number of bytes to be written.</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>XST_SUCCESS if successful else XST_FAILURE.</dd></dl>
<dl class="section note"><dt>Note</dt><dd>None</dd></dl>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">SpiPtr</td><td>is a pointer to the instance of the Spi device. </td></tr>
    <tr><td class="paramname">Addr</td><td>is the address in the Buffer, where to write the data. </td></tr>
    <tr><td class="paramname">ByteCount</td><td>is the number of bytes to be written. </td></tr>
    <tr><td class="paramname">WriteCmd</td><td>is the command used for writing data to flash.</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>XST_SUCCESS if successful else XST_FAILURE.</dd></dl>
<dl class="section note"><dt>Note</dt><dd>None </dd></dl>

<p>References <a class="el" href="xspi__numonyx__flash__quad__example_8c.html#ab499519eaab61d0f334591c02a7b15f1">READ_WRITE_EXTRA_BYTES</a>, and <a class="el" href="group__spi.html#ga4c44c082ef2d2b9cf4ba3db8bcebd954">XSpi_Transfer()</a>.</p>

<p>Referenced by <a class="el" href="xspi__numonyx__flash__quad__example_8c.html#a840291bc02cba5474a4cb46a9b9566fe">main()</a>.</p>

</div>
</div>
<a class="anchor" id="a48599e715e854c930ad7682db64c5716"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int SpiFlashWriteEnable </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="struct_x_spi.html">XSpi</a> *&#160;</td>
          <td class="paramname"><em>SpiPtr</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>This function enables writes to the Numonyx Serial Flash memory. </p>
<p>This function enables writes to the Winbond Serial Flash memory.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">SpiPtr</td><td>is a pointer to the instance of the Spi device.</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>XST_SUCCESS if successful else XST_FAILURE.</dd></dl>
<dl class="section note"><dt>Note</dt><dd>None </dd></dl>

<p>References <a class="el" href="group__spi.html#ga4c44c082ef2d2b9cf4ba3db8bcebd954">XSpi_Transfer()</a>.</p>

<p>Referenced by <a class="el" href="xspi__numonyx__flash__quad__example_8c.html#a840291bc02cba5474a4cb46a9b9566fe">main()</a>, <a class="el" href="xspi__winbond__flash__quad__example_8c.html#a29b2b437252838fd655646e018a44fa8">SpiFlashEnableHPM()</a>, and <a class="el" href="xspi__winbond__flash__quad__example_8c.html#aa80e27c647fe6b86b58019a9af60c1b3">SpiFlashQuadEnable()</a>.</p>

</div>
</div>
<a class="anchor" id="aacdc7be0761bc23854d5f1b9c6dbe36a"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void SpiHandler </td>
          <td>(</td>
          <td class="paramtype">void *&#160;</td>
          <td class="paramname"><em>CallBackRef</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">u32&#160;</td>
          <td class="paramname"><em>StatusEvent</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">unsigned int&#160;</td>
          <td class="paramname"><em>ByteCount</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>This function is the handler which performs processing for the SPI driver. </p>
<p>It is called from an interrupt context such that the amount of processing performed should be minimized. It is called when a transfer of SPI data completes or an error occurs.</p>
<p>This handler provides an example of how to handle SPI interrupts and is application specific.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">CallBackRef</td><td>is the upper layer callback reference passed back when the callback function is invoked. </td></tr>
    <tr><td class="paramname">StatusEvent</td><td>is the event that just occurred. </td></tr>
    <tr><td class="paramname">ByteCount</td><td>is the number of bytes transferred up until the event occurred.</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>None.</dd></dl>
<dl class="section note"><dt>Note</dt><dd>None. </dd></dl>

</div>
</div>
</div><!-- contents -->
</div><!-- doc-content -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
	<p class="footer">&copy; Copyright 2015-2022 Xilinx, Inc. All Rights Reserved.</p>
	<p class="footer">&copy; Copyright 2022-2023 Advanced Micro Devices, Inc. All Rights Reserved.</p>
</div>
</body>
</html>
